<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateActivityLogsTable extends Migration
{
  /**
   * Run the migrations.
   */
  public function up(): void
  {
    Schema::create('activity_logs', function (Blueprint $table) {
      $table->id();
      // $table->uuid('batch')->nullable();
      $table->binary('batch', 16)->nullable();
      $table->string('event')->index();
      $table->string('ip');
      $table->text('description')->nullable();
      $table->nullableMorphs('actor');
      $table->json('properties');
      $table->timestamp('timestamp')->useCurrent()->onUpdate(null);
    });
  }

  /**
   * Reverse the migrations.
   */
  public function down(): void
  {
    Schema::dropIfExists('activity_logs');
  }
}
